<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <title>首页</title>
    <script type="text/javascript" src="/js/jquery-1.7.2.js"></script>
    <script type="text/javascript">
        $(function () {
            $(".find").click(function () {
                $.ajax({
                    type: "GET",
                    url: "[[@{/find(name=${session.newFileName})}]]",
                    success: function (data) {
                        console.log(data);
                    },
                    dataType: "json"
                })
            });

        })
    </script>
</head>
<body>
<h1 style="text-align: center">欢迎来到文件管理系统</h1>
<h2>上传文件：</h2>
<form method="post" th:action="@{/upload}" enctype="multipart/form-data">
    <input type="file" name="file">
    <input type="submit" value="提交">
</form>
<h2>新的文件名：<span th:text="${session.newFileName}"></span></h2>
<h2>文件下载：</h2>
<a th:href="@{/download(name=${session.newFileName})}">下载</a>
<h2 th:if="${session.code}=='410'" th:text="${session.code}"></h2>
<h2>查询文件元数据：</h2>
<button class="find" >查询</button>
<!--th:href="@{/find(name=${session.newFileName})}"-->
</body>
</html>